using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class SetDriftBottleHead : BasePage
	{
		private const string TAG = "SetDriftBottleHead";
		private EventWatcher mWatchContactListChange;
		internal Grid LayoutRoot;
		internal DriftBottleSetHeadCtrl ctrlSetHead;
		private bool _contentLoaded;
		public SetDriftBottleHead()
		{
			this.InitializeComponent();
			this.SetAppBarWording();
		}
		private void Page_Loaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("SetDriftBottleHead", "Page_Loaded");
		}
		private void Page_Unloaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("SetDriftBottleHead", "Page_Loaded");
		}
		protected override void OnPageIn(object[] object_0)
		{
			Log.smethod_5("SetDriftBottleHead", "OnPageIn");
			this.ctrlSetHead.Init(new UITaskDlgEx(this.setHeadCtrlHandler));
		}
		protected override void OnPageOut()
		{
			Log.smethod_5("SetDriftBottleHead", "OnPageOut");
			this.ctrlSetHead.UnInit();
			this.setHeadEnd();
		}
		protected override void OnPageBack()
		{
			Log.smethod_5("SetDriftBottleHead", "OnPageBack");
		}
		private void registerEvent()
		{
			if (this.mWatchContactListChange == null)
			{
				this.mWatchContactListChange = new EventWatcher(this, this, new EventHandlerDelegate(this.OnContactChange));
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
			}
		}
		private void unRegisterEvent()
		{
			if (this.mWatchContactListChange != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
				this.mWatchContactListChange = null;
			}
		}
		private void OnContactChange(EventWatcher watcher, BaseEventArgs evtArgs)
		{
		}
		private void btnSetHead_Click(object sender, RoutedEventArgs e)
		{
		}
		private void ApplicationBarIconButton_Click(object sender, EventArgs e)
		{
			ConfigMgr.setBool("bNotFirstInDriftBottle", true);
			if (AccountMgr.IsAcountInfoCompleted())
			{
				ToolFunction.GotoPageForUserControl("/Source/Plugin/DriftBottle/UI/DriftBottleMainPage.xaml", null, true);
				return;
			}
			ToolFunction.GotoPageForUserControl("/Source/Plugin/Lbs/UI/LbsInputUserInfo.xaml", new object[]
			{
				strings.Float_Bottle_Title,
				"/Source/Plugin/DriftBottle/UI/DriftBottleMainPage.xaml"
			}, true);
		}
		public void SetAppBarWording()
		{
			if (base.get_ApplicationBar() != null && 1 == base.get_ApplicationBar().get_Buttons().get_Count())
			{
				ApplicationBarIconButton applicationBarIconButton = (ApplicationBarIconButton)base.get_ApplicationBar().get_Buttons().get_Item(0);
				applicationBarIconButton.set_Text(strings.PCon_Bind_BtnComplete);
			}
		}
		private void setHeadStart()
		{
			ProcessingCover.getProgressBar(this.LayoutRoot, strings.Set_Personal_SendingImage, null, false, false, null);
		}
		private void setHeadEnd()
		{
			ProcessingCover.releaseProgressBar(this.LayoutRoot);
		}
		private void setHeadCtrlHandler(object object_0)
		{
			if (object_0 == null)
			{
				return;
			}
			BtleSetHeadOpKind btleSetHeadOpKind = (BtleSetHeadOpKind)object_0;
			if (BtleSetHeadOpKind.OpKind_SetStart == btleSetHeadOpKind)
			{
				this.setHeadStart();
				return;
			}
			if (BtleSetHeadOpKind.OpKind_SetEnd == btleSetHeadOpKind)
			{
				this.setHeadEnd();
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/DriftBottle/UI/SetDriftBottleHead.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.ctrlSetHead = (DriftBottleSetHeadCtrl)base.FindName("ctrlSetHead");
		}
	}
}
